<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <title>一笑网-注册</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="../../static/layui/css/layui.css" />
        <link rel="stylesheet" href="../../static/css/yx.css" />
        <script src="../../static/js/jquery-2.1.4.min.js" ></script>
        <script src="../../static/layui/layui.all.js" ></script>
        <script src="../../static/js/yx.js" >/*公共js*/</script>
        
        <style type="text/css">
        	
        	html{height: 100%;}
        	body{height: 100%;background-size: 100% 100%;background-image: url(../../static/img/login.jpg);}
        	.formfox{
        		max-width: 30rem;min-height: 15rem;
        		padding: 3em 4em;
        		background-color: #FFF;
        		margin: 10rem auto;
        	}
        	
        	.formfox *{border-radius: 0px;}
        	.formfox a{margin-left: 1em;color: #666;}
        	.formfox a:hover{color: red;}
        	
        	
        </style>
        <script type="text/javascript">
        	
        	
        	$(function(){
        		
        		//监听回车
        		$("input").bind("keypress",function(e){  
				  	// 兼容FF和IE和Opera      
				    var theEvent = e || window.event;      
				    var code = theEvent.keyCode || theEvent.which || theEvent.charCode;      
				    if (code == 13) {                    
				        e.preventDefault();
				    	//回车执行查询  
				    	$(".zhuce").click();   
				    }   
				});
        		
        		$(".zhuce").click(function(){
        			var uname=$("[name=uname]").val();
        			var pwd=$("[name=pwd]").val();
        			var pwd2=$("[name=pwd2]").val();
        			if(uname==""||pwd==""){
        				return layer.error("请输入昵称、密码、以及确认密码");
        			}else if(isNaN(uname)==false){
        				return layer.error("昵称不可以纯数字");
        			}else if(is_xxs(uname)){
        				return layer.error("昵称里含有违规字符(如：script、on...)");
        			}else if(pwd!=pwd2){
        				return layer.error("两次密码不一样");
        			}else if(pwd.length<6){
        				return layer.error("为了您的账号安全，请不要输入太短的密码");
        			}
        			
        			$.post2("doZhuce.ajax",{uname:uname,pwd:pwd},function(data){
						if(data.res==1){
							layer.alert('注册成功，欢迎加入一笑网',{closeBtn: 0},function(){
								var str="为了你的账号安全，建议你现在就去绑定手机号码，以便在密码丢失等情况下可以通过手机找回";
								layer.confirm(str,{btn:['确认','以后再说'],closeBtn: 0},function(){
			        				location.href="../user/us_phone.jsp";
			        			},
				        		function(){
				        			location.href="../home/index.html";
			        			});
							});
							$("input").blur();
						}else{
							layer.error(data.msg);
						}
					},function(e,ee,eee){
						layer.alert('异常：'+eee);
					})
        			
        		})
        		
        		
        	})
        	
        	
        </script>
    </head>
    <body class="yx-phone-max-height">
    	
    	<div class="formfox">
    		<h2 class="yx-color-one">一笑网 注册</h2><br />
    		<input name="uname" class="layui-input yx-input" placeholder="想一个昵称"/><br />
    		<input name="pwd" class="layui-input yx-input" type="password" placeholder="密码"/><br />
    		<input name="pwd2" class="layui-input yx-input" type="password" placeholder="再次确认密码"/><br />
    		<button class="zhuce layui-btn yx-bg-one" type="button">注册</button>
    		<a href="login.html">去登录</a>
    	</div>
    	
 	</body>
</html>